<?php


namespace app\api\validate;


use think\Validate;

class CouponValidate extends Validate
{

    /**
     * 验证规则
     */
    protected $rule = [
        'status' => ['require', 'in:0,1,2,3'],
        'use_type' => ['require', 'in:mini,pc'],
        'coupon_id' => ['require','number', 'gt:0'],
    ];

    /**
     * 提示消息
     */
    protected $message = [];

    /**
     * 验证场景
     */
    protected $scene = [
        'getUserCouponPageList' => ['status'],
        'getCouponPageList' => ['use_type'],
        'drawCoupon' => ['coupon_id'],
        'getUserCouponExchangePageList' => ['status'],
    ];

    public function __construct(array $rules = [], $message = [], $field = [])
    {
        $this->field = [
            'status' => '优惠券状态',
            'use_type' => '使用位置',
            'coupon_id' => '优惠券ID',
        ];
        parent::__construct($rules, $message, $field);
    }
}